import { User } from "@/types/system/user";
import { get, post, put, remove } from "@/utils/request";
/**
 * 获取用户信息列表
 * * @param data
 * @returns
 */
export const queryUserList = (data: User.Query & PageParams) => post<PageVo<User.Row>>(`/user/queryUserList`, data);

/**
 * 修改用户信息
 * @param data
 * @returns
 */
export const changeUserInfo = (data: User.Form) => put(`/user/userInfo`, data);
/**
 * 查询用户信息
 * @param data
 * @returns
 */
export const queryUserById = (id: string) => get(`/user/${id}`);
/**
 * 注册用户
 * @returns
 */
export const addUser = (data: User.Form) => post(`/user/register`, data);
/**
 * 设置角色
 * @returns
 */
export const setRole = (data: User.UserRole) => post(`/user/setRole`, data);

/**
 * 删除角色
 * @returns
 */
export const deleteUser = (data: IdsType) => remove(`/user/batchRemove`, data);
/**
 *找回密码
 * @param email
 * @returns
 */
export const sendFindPwdCode = (email: string) => get(`/user/sendFindPwdCode?to=${email}`, {}, { headers: { login: true } });
/**
 * 找回密码
 * @param data 
 * @returns 
 */
export const findPwd = (data: User.FindPwd) => post(`/user/findPwd`,data,{headers: {login: true}}
);
